<template>
  <div class="contributeDetail">
    <!-- 添加或修改用户投稿对话框 -->
    <el-dialog :visible.sync="openFlag" width="1300px" center append-to-body>
      <div class="container">
        <div class="title">
          <p>{{ content.title }}</p>
        </div>
        <div class="text" v-html="content.content">
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button v-if="content.statue ===1"  v-hasPermi="['contribute:contribute:check']" type="primary" @click="handPass(2)">审核通过</el-button>
        <el-button v-if="content.statue ===1" v-hasPermi="['contribute:contribute:check']" @click="handPass(3)">审核退回</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {

  updateContribute
} from '@/api/contribute/contribute'

export default {
  name: 'contribute-detail',
  data() {
    return {
      openFlag: false
    }
  },
  props: {
    open: {
      type: Boolean,
      default: false
    },
    content: {
      type: Object
    }
  },
  watch: {
    open: {
      handler(newVal) {
        this.openFlag = newVal
      }
    },
    openFlag: {
      handler(newVal) {
        this.$emit('update:open', newVal)
      }
    }
  },
  methods: {
    handPass(val) {
      updateContribute({ id: this.content.id, statue: val }).then(response => {
        this.$modal.msgSuccess('审核完成')
        this.openFlag = false
        this.$parent.getList()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.container .title {
  text-align: center;
  height: 80px;
  padding: 0 20px;
  line-height: 1.4em;
  margin-bottom: 15px;
  font-size: 36px;
  align-items: center;
  font-weight: bold;

}

.text {
  font-size: 18px;
  text-indent: 20px;
  line-height: 2em;
}
</style>
